
jQuery(document).ready(function(){

		
var qiehuan=jQuery(".banner li");
   var qietext=jQuery(".banner_text li");
   var bottn=jQuery(".current-wrap li");
   var speed=4000;
   var nowindex=0;
   var length=qiehuan.length;

   
   qiehuan.eq(nowindex).fadeIn('slow').siblings().fadeOut('slow');
   
   function play(){
	   nowindex++;
	   if(nowindex>length-1)
	     {
			 nowindex=0
		    $(".current-wrap ul").animate({left:0},500) 	 
	    }
	  else if(nowindex==3)
	    {
		  $(".current-wrap ul").animate({left:0},500) 
		 }	
	    qiehuan.eq(nowindex).fadeIn('slow').siblings().fadeOut('slow');
	    qietext.eq(nowindex).fadeIn('slow').siblings().fadeOut('slow');
	    bottn.eq(nowindex).addClass('current').siblings().removeClass('current');

	   
	  
	   }


   jQuery(".current-wrap li").click(function(){ 
       clearInterval(tme);
	   jQuery(this).addClass('current').siblings().removeClass('current');
	   index=bottn.index(jQuery(this));
	   qiehuan.eq(index).fadeIn('slow').siblings().fadeOut('slow');
	   qietext.eq(index).show().siblings().hide();
	   tme=setInterval(play , speed) 
	   })
	
	$(".next").click(function(){
		clearInterval(tme);
		play()
		tme=setInterval(play , speed) 
		})
    $(".prev").click(function(){
		
		
		clearInterval(tme);
		nowindex--;

	   if(nowindex<0)
	     {
			 nowindex=length-1
		    $(".current-wrap ul").animate({left:0},500) 	 
	     }
	 if(nowindex==1)
	     {

		    $(".current-wrap ul").animate({left:0},500) 	 
	     }	 
	  
	    qiehuan.eq(nowindex).fadeIn('slow').siblings().fadeOut('slow');
	    qietext.eq(nowindex).fadeIn('slow').siblings().fadeOut('slow');
	    bottn.eq(nowindex).addClass('current').siblings().removeClass('current');
		
		tme=setInterval(play , speed) 
		
		
		})

		tme = setInterval(play, speed);




		/*****************2014-04-30***********/
		(function() {

		    scrpc($('.lst_bottscrlist ul'), $('.lst_bottscr .fl'), $('.lst_bottscr .fr'));

		    function scrpc(scrul, left, right) {
		        var l = scrul.children("li").length;
		        var w = scrul.children("li").outerWidth(true) * l;
		        var num = 0;
		        var b = 1;
		        var timer = setInterval(yundong, 10);

		        if (l <= 6) { return false; }
		        scrul.width(2 * w);
		        scrul.children("li").clone().appendTo(scrul);

		        left.mouseenter(function() {
		            b = 1;
		        })


		        right.mouseenter(function() {
		            b = 0;
		        })
		        function yundong() {
		            if (b) {
		                scrul.css('marginLeft', num -= 1);
		                if (num < -w) {
		                    num = 0;
		                }
		            } else {
		                scrul.css('marginLeft', num += 1);
		                if (num > 0) {
		                    num = -w;
		                }
		            }
		        }

		        scrul.hover(function() {
		            clearInterval(timer);
		        }, function() {
		            timer = setInterval(yundong, 10);
		        })

		    }

		})(); 
  
	
	 
	
		
	   

});









/*$(function() {

if (($(".banner img:eq(0)").width() - $(window).width()) > 0)
 {
	$(".banner li").each(function() {
		$(this).css("margin-left", "-" + ($(".banner img:eq(0)").width() - $(window).width()) / 2 + "px")
	});
}
var nowindex = 0;
var speed = "slow";
var time = 5000;
var bottoncurrentclass = "current";
var imagesivclass = "banner";
var bottondivclass = "botton";

var $prev=$('.prev');
	var $next=$('.next');
	var $element=$('.current-wrap').children();
	var count = 1;
function AutoPlay() {
	var nextindex = nowindex + 1;
	if (nextindex > $("." + imagesivclass + " li").length - 1) nextindex = 0;
	
	$("." + imagesivclass + " li").eq(nowindex).fadeOut(speed,
	function() {
		$("." + bottoncurrentclass).removeClass(bottoncurrentclass);
		$("." + imagesivclass + " li").eq(nextindex).fadeIn(speed);
		$("." + bottondivclass + " li").eq(nextindex).addClass(bottoncurrentclass);
		
		if(nextindex >=3)
		{
			$next.click();
			
		} 
		
		if(nextindex ==0)
		{
			$element.animate({left:0})
			count = 1;
		}
		
	});
	nowindex = nextindex;
}








	

	$next.click(function(){
		if(count<3){
		$element.animate({left:-(count*132)})
		count ++;
		}
	 alert(0)	
	})
	
	$prev.click(function(){
	
		if(count>1){
		count--;
		$element.animate({left:count==1?0:-132})
		}
		
	})
	
	$("." + imagesivclass + " li").hide();
	$("." + imagesivclass + " li").eq(nowindex).show();
	$("." + bottondivclass + " li").click(function() {
		var index = $("." + bottondivclass + " li").index($(this));
		var cindex = $("." + bottondivclass + " li").index($("." + bottoncurrentclass));
		$("." + imagesivclass + " li").eq(cindex).fadeOut(speed,
		function() {
			$("." + bottoncurrentclass).removeClass(bottoncurrentclass);
			$("." + imagesivclass + " li").eq(index).fadeIn(speed);
			$("." + bottondivclass + " li").eq(index).addClass(bottoncurrentclass);
		});
		clearInterval(autoplay);
		nowindex = index;
		autoplay = setInterval("AutoPlay()", time);
	});
	var autoplay = setInterval("AutoPlay()", time);
});*/